@extends('Layout.art')
@section("content")
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
 <script type="text/javascript" src="/home/js/jquery-1.8.2.min.js"></script>

  <form class="form-horizontal" method="post" action="/art">
  <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">  
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">标题</label>
    <div class="col-sm-8">
      <input type="title" class="form-control" id="title" name="title">
    </div>
  </div>


  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">内容</label>
    <div class="col-sm-8">
       <!-- <textarea class="form-control" rows="5" id="content" name="content"></textarea> -->
         <script id="container" name="content" type="text/plain">
   
    </script>

    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('container');
    </script>
    </div>

  </div>
   
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default">创建</button>&nbsp;
      <button type="submit" class="btn btn-default" name="btn">预览</button>
    </div>
  </div>

  <!-- 预览区 -->
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label"></label>
    <div class="col-sm-8">
       <textarea class="form-control" rows="5" id="new" name="content"></textarea>
    </div>
  </div>
   

</form>
<script>
  $("button[name='btn']").click(function(){
  // var ue = UE.getEditor('container');
  //获取uEditor的文本值
  var content = ue.getContent();
    // alert(content);
  
    $.ajax({
      url:'/demo/show',
      type:"post",
      data:{content:content},
      async:true,
      success:function(res){
        alert(res);
      
         // $("#new").html(eval(res));
      }
    })
  });

</script>
@endsection